
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #imgs{
            height: 200px;
        }
    </style>
</head>
<body>
    <div id="se" align="center">
        <select id="sele">
            <option>选择大小</option>
            <option >选择小</option>
            <option >选择大</option>
        </select>
    </div>
    <div id="imgs" value='' align="center">
        <img id="im" src="./imgs/2/1.jpg">
    </div>
    <br>
    <br>
    <div id="but" align="center">
        <button type="button" onclick="cc(event)">开始</button>
    </div>
</body>
    <script type="text/javascript">
        var a=1;
        function cc(event) {
            var imgs=document.getElementById('im');
            var sum=getRandValidNum();
            var to=setInterval(function(){
                document.getElementsByTagName('button')[0].innerHTML='抽奖中。。'
                document.getElementsByTagName('button')[0].disabled="disabled" 
                
                var imgs=document.getElementById('im')
                    imgs.src="imgs/2/"+a+".jpg"
                    imgs.value=a;
                    a++;
                if(a>=7){
					a=1;
				}
            },sum);
            
            setTimeout(function(){
				clearInterval(to);
                document.getElementsByTagName('button')[0].disabled="" 
				document.getElementsByTagName('button')[0].innerText="重新抽奖"
                var imgg=document.getElementById('im');
                var dd='';
                if(imgs.value<=3){
                    dd="1";
                }
                else if(imgs.value>3)
                {
                    dd="2";
                }
                var sele=document.getElementById("sele")
                var ss=sele.selectedIndex;
                if(dd == ss)
                {
                    alert("猜对了");
                }
                else{
                    alert("猜错了");
                }
			},5000)
        }
        function getRandValidNum(){
			while(true){
				var randNum = Math.floor((Math.random()*100)+50);
                if(randNum!=0){
                    return randNum;
                }
			}				
		}
    </script>
</html>